package wsepForum.ui.swing;

import java.awt.EventQueue;

import wsepForum.network.client.GUIController;
import wsepForum.network.client.SimpleClient;

/**
 * @author
 *
 */
public class ClientApplication {


	/**
	 *
	 */
	public ClientApplication(String serverAddress) {
		final GUIController controller = new GUIController();
		SimpleClient clientConnection = new SimpleClient(serverAddress, 2323, controller);
		controller.setClient(clientConnection);
		clientConnection.start();
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ForumFrame frame = new ForumFrame(controller);
					frame.draw();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});

	}

	public static void main(String[] args) {
		if (args.length == 0)
			new ClientApplication("localhost");
		else 
			new ClientApplication(args[0]);
	}

}
